<?php

namespace App\Http\Resources\Admin;

use App\Http\Resources\BaseResource;

class TaskResource extends BaseResource
{
    /**
     * Transform the resource collection into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'remark' => $this->remark,
            'date' => $this->date,
            'type' => $this->type,
            'body' => $this->body,
            'result' => $this->result,
            'type_text' => get_model_code('task.type', $this->type),
            'mold' => (string) $this->mold,
            'mold_text' => get_model_code('task.mold', $this->mold),
            'created_at' => $this->created_at->format('Y-m-d H:i:s'),
        ];
    }
}
